package com.dy.tieba.serviceImpl;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.dy.tieba.db.RobotPost;
import com.dy.tieba.service.UserRobotService;

import lib.BasicService;
import lib.MySQLHelper;

public class UserRobotServiceImpl extends BasicService implements UserRobotService {

	@Override
	public List<RobotPost> getRobots(String sql, int startPage, int pageSize, String order) {
		String sqlStr = String.format("1=1 order by id %s limit %s, 10", order, startPage*10);
		if(StringUtils.isNoneBlank(sql)){
			sqlStr =  String.format("%s and %s", sql, sqlStr);
		}
		return MySQLHelper.find(RobotPost.class, sqlStr);
	}
}
